package learn.spring.init.service;

import learn.spring.init.annotation.Autowired;
import learn.spring.init.annotation.Component;
import learn.spring.init.annotation.Scope;
import learn.spring.init.aware.BeanNameAware;
import learn.spring.init.init.InitializingBean;

/**
 * @author ShenHao
 */
@Scope
@Component("orderService")
public class OrderService implements InitializingBean, BeanNameAware {

    @Autowired
    private UserService userService;

    private String beanName;

    public void test() {
        System.out.println(userService);
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("初始化");
    }

    @Override
    public void setBeanName(String beanName) {
        System.out.println("beanName = " + beanName);
        this.beanName = beanName;
    }
}
